<?php if (!defined("_ECRIRE_INC_VERSION")) return; if (class_exists('RubriqueGroupeModel')) return;

include_spip('classes/pdk_model'); 
class RubriqueGroupeModel extends pdk_Model {   
    
    public function __construct() {
        parent::__construct();
        $this->config_model();
    }
    
    function config_model() {
        // Define main table:
        $this->main_table = 'spip_ecatalogue_rubriques_groupes';
        
        // Define primary key:
        $this->primary_key = 'id_groupe';
        
        // Define main table fields:
        $this->main_fields['id_rubrique'] = 'id_rubrique';
        $this->main_fields['id_groupe'] = 'id_groupe';
                                                                                 
        // Define validation rules:
        $this->validation->set_rules(
            array(
                array(
                    'field'   => 'id_rubrique',
                    'label'   => 'ID rubrique',
                    'rules'   => 'required'
                ),
                array(
                    'field'   => 'id_groupe',
                    'label'   => 'ID groupe',
                    'rules'   => 'required'
                )
            )
        );
    }
} 
?>